MOD_H = %%mods_h%%
MOD_O = %%mods_o%%

LIBS = -lm -lfl

patches: main.c garbage.o truerand.o libpatches.o hashtable.o parser.tab.o scanner.o modules.o ${MOD_O}
	gcc -o patches main.c garbage.o truerand.o libpatches.o hashtable.o parser.tab.o scanner.o modules.o ${MOD_O} ${LIBS}

garbage.o: garbage.c garbage.h
	gcc -c garbage.c

truerand.o: truerand.c truerand.h
	gcc -c truerand.c

libpatches.o: libpatches.c libpatches.h types.h
	gcc -c libpatches.c

hashtable.o: hashtable.c hashtable.h
	gcc -c hashtable.c

scanner.o: scanner.c
	gcc -c scanner.c

parser.tab.o: parser.tab.c parser.tab.h
	gcc -c parser.tab.c

scanner.c: scanner.l parser.tab.h
	flex -oscanner.c scanner.l

parser.tab.c parser.tab.h: parser.y libpatches.h
	bison -v -d parser.y

modules.o: modules.c modules.h ${MOD_H} ${MOD_O}
	gcc -c modules.c

clean:
	rm -f *.o modules/*.o parser.tab.[ch] parser.output scanner.[ch] patches core

#modules 

%%modules%%
